import request from '#/utils/requestAbort';
import { operators } from './helper';
import { SERVER_URL_OBJ } from '@/../config/urlConfig';

export async function queryReanalyzeDataData(params) {
  const { order, param } = params;
  return request('/generation-common/flexible-aggregation/flexibleAggregation', {
    method: 'POST',
    data: {
      cacheable: true,
      needTotal: true,
      newWay: true,
      newOperators: operators,
      order,
      param: JSON.stringify(param),
      url: `${
        SERVER_URL_OBJ[`${CLIENT_ENV === 'dev' ? 'test' : CLIENT_ENV}` || 'release']
      }/reanalyze/electricityRateAnalysis/electricityRateAnalysisData`,
    },
  });
}

export async function getDynamicColumns(params) {
  return request('/reanalyze/generalDynamicColumns/getDynamicColumns', {
    method: 'POST',
    data: params,
  });
}
export async function saveDynamicColumns(params) {
  return request('/reanalyze/generalDynamicColumns/saveDynamicColumns', {
    method: 'POST',
    data: params,
  });
}
